<template>
 <div>
     <div class="navcontainer _navcontainer h60 fix-top" id="brf">
        <div class="navicon _navicon"><i class="iconfont icon-caidan" @click="opencaidan()"></i></div>
        <div class="header-mobile">
            <MobileVueNatTop />
        </div>

        <div class=" width100 header view flex-row align-center p-l-45 p-r-45 justify-between height100" >
            <div class="w138 h37 wow lightSpeedInLeft">
                <img :src="require('../Home/imgs/logo.png')" class="width100 height100"/>
            </div>

            <div class="view flex-row align-center wow lightSpeedInRight">
                <div class="fz-16 c-fff m-r-85 curpor horc active">生态藏品</div>
                <div class="fz-16 c-fff m-r-85 curpor horc">路线图</div>
                <div class="fz-16 c-fff m-r-85 curpor horc">资讯</div>
                <div class="fz-16 c-fff m-r-85 curpor horc">常见问题</div>
                <div class="fz-16 c-fff curpor horc">APP下载</div>
            </div>

            <div class="view flex-row align-center justify-center">
                <img :src="require('../Home/imgs/langage.png')" style="width:20px;height:20px;" class="m-r-8 "/>
                <div class="fz-14 c-fff">选择语言</div>
            </div>
        </div>
    </div>
    <div class="p-t-60"></div>
 </div>
  
</template>

<script>

import MobileVueNatTop  from './mobile-vue-natTop.vue'
export default {
  name: 'navtop',
  components: {
      MobileVueNatTop
  },
  data() {
      return {
          nalistshowflag:false
      }
  },
  mounted() {
      let that = this
      if (window.innerWidth > 768 ) {
          /**
         * 监听滚动条 逻辑根据自己需求来哦
         */
        window.onscroll = function () {
            let scrollPos = that.getScrollTop();
            console.log("scrollPos：",scrollPos);
            if (scrollPos == 0) {
                $('#brf').removeClass('bg-ddd')
            } else {
                $('#brf').addClass('bg-ddd')
            }
        }
      }
  },
  methods: {
      getScrollTop() {
        var scrollPos;
        if (window.pageYOffset)
        {
            scrollPos = window.pageYOffset;
        }
        else if (document.compatMode && document.compatMode != 'BackCompat')
        {
            scrollPos = document.documentElement.scrollTop;
        }
        else if (document.body)
        {
            scrollPos = document.body.scrollTop;
        }
        return scrollPos;
        },
      routerpush(to){
        this.$router.push(to)
        // 跳转之后，记得关闭菜单（在屏幕宽度小于800的时候才生效）
        var dom=document.getElementById('navID')
          if(dom.classList.contains('navlistshow')){
              dom.classList.remove('navlistshow')
          }

      },
    //当屏幕宽度小于800的时候，点击菜单图标，显示隐藏的菜单
      opencaidan(){
          var dom=document.getElementById('navID')

          if(dom.classList.contains('navlistshow')){
              return
          }
          dom.classList.add('navlistshow')
      },
    //当屏幕宽度小于800的时候，点击关闭按钮， 关闭菜单
      closecaidan(){
          var dom=document.getElementById('navID')
          if(dom.classList.contains('navlistshow')){
              dom.classList.remove('navlistshow')
          }
      }
  },
}
</script>

<style lang="less" scoped>
.curpor {
    cursor: pointer;
    transition: all ease .5s;
}
.horc:hover {
    color: #F6E0A5
}
.active {
    color: #F6E0A5
}


// 大于800px
@media only screen and (min-width: 800px){

.header-mobile {
    display: none !important;
}
.navcontainer{
    top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0,0,0,.02);
    transition: all ease .5s;
    .navicon{
       display:none; 
       cursor: pointer;
    }
    .navicon:hover{
       color:white;
    }
    .appleicon{
        width: 100px;
        cursor: pointer;
    }
    .appleicon:hover{
        color:white;
        }
    .mainnavlist{
        display: flex;
        align-items: center;
        justify-content: center;
        height: 40px;
        .navlistclose{
            display: none;
        }
        div{
            text-align: center;
            height: 40px;
            line-height: 40px;
            width: 95px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 500;
        }
        div:hover{
            color:white;
        }
    }
    .shopcar{
        width: 100px;
        cursor: pointer;
    }
    .shopcar:hover{
        color:white;
    }
}
}
// 小于800px
@media only screen and (max-width: 800px){
    .header {
        display: none !important;
    }
}
.fix-top {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
}
.bg-ddd {
    background-color: #000 !important;
}
</style>